<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>

    <script src="./vue.js"></script>
    <script>
      // 定义组件
      const App = {
        template: '<h1>app组件,{{msg}}</h1>',
        data() {
          return {
            msg: 'xxx',
          }
        },
      }
      new Vue({
        // 注册组件
        components: {
          app: App,
        },
        // vue实例中的template会覆盖vue实例所对应的模板
        template: `<div id="app">
            <app></app>
        </div>`,
      }).$mount('#app')
    </script>
  </body>
</html>
